<script language="javascript">
$(function(){ 
    $("#sort").change(function(){ 
        getSelectVal(); 
    }); 
});

function getSelectVal()
{
	var sortIndex = 0;
	if ($("#sort").val() == '报纸')
	{
		sortIndex = 1;
	}
	else if ($("#sort").val() == '杂志')
	{
		sortIndex = 2;
	}
	else
	{
		sortIndex = 3;
	}

	$.getJSON(
		"__URL__/getSelect/type/1/sort/" + sortIndex,
		function(json)
		{         
			var typeID = $("#typeID");         
			$("option",typeID).remove();   
			$.each(json,function(index,array)
			{             
			
				var option = "<option value='"+array['id']+"'>"+array['title']+"</option>";             
				typeID.append(option);         
			});     
		}
	); 
} 
</script>
<form id="pagerForm" action="__URL__" method="post">
	<input type="hidden" name="pageNum" value="1"/>
	<input type="hidden" name="typeID" value="{$_REQUEST.typeID}"/>
	<input type="hidden" name="sort" value="{$_REQUEST.sort}"/>
</form>

<div class="page">
	<div class="pageHeader">
		<form onsubmit="return navTabSearch(this);" action="__URL__" method="post">
		<input type="hidden" name="pageNum" value="1"/>
		<div class="searchBar">
			<ul class="searchContent">
				<li style="width:200px;">
					<label>所属分类：</label>
					<select name="sort" id="sort">
						<option value="">--请选择--</option>
						<option <eq name="_REQUEST.sort" value="报纸" >selected</eq> value="报纸">报纸</option>
						<option <eq name="_REQUEST.sort" value="杂志" >selected</eq> value="杂志">杂志</option>
				</select>
				</li>
				<li style="width:210px;">
					<label>报刊类别：</label>
					<select name="typeID" style="width:120px" id="typeID">
						<option value="">--请选择--</option>
					<volist name="MagazineTypeList" id="MagazineTypeVo">
						<option <eq name="_REQUEST.typeID" value="$MagazineTypeVo.id" >selected</eq>
						value="{$MagazineTypeVo['id']}">{$MagazineTypeVo['name']}</option>
					</volist>
				</select>
				</li>				
			</ul>
			<div class="subBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
				</ul>
			</div>
		</div>
		</form>
	</div>
	
	<div class="pageContent">
		<div class="panelBar">
			<ul class="toolBar">
				<li><a class="add" href="__URL__/add" target="dialog" width="400" height="350" mask="true"><span>新增</span></a></li>
				<li><a class="edit" href="__URL__/edit/id/{id}" target="dialog" width="400" height="350"  mask="true" warn="请选择一条记录"><span>编辑</span></a></li>
				<if condition="($roleEname eq 'admin') OR ($roleEname eq 'customCenterWorker')">
				<li><a class="delete" href="__URL__/foreverdelete/id/{id}/navTabId/{$Think.const.MODULE_NAME}" target="ajaxTodo" title="你确定要删除吗？" warn="请选择一条记录"><span>删除</span></a></li>
				<else />
				<li><a class="delete" href="__URL__/delete/id/{id}/navTabId/{$Think.const.MODULE_NAME}" target="ajaxTodo" title="你确定要删除吗？" warn="请选择一条记录"><span>删除</span></a></li>
				</if>
				<li><a class="icon" href="__URL__/detail/id/{id}/navTabId/{$Think.const.MODULE_NAME}" target="dialog" width="400" height="350"  mask="true"  warn="请选择一条记录"><span>详细</span></a></li>	
			</ul>
		</div>

		<table class="table" width="2000" layoutH="140">
			<thead>
			<tr>
				<th width="100">发行代码</th>
				<th width="150">报刊名称</th>
				<th width="80">所属报刊</th>
				<th width="80">所属分类</th>
				<th width="80">最大分包数</th>
				<th width="100">库存管理员</th>
				<if condition="($roleEname eq 'admin') OR ($roleEname eq 'customCenterWorker')">
				<th width="60">状态</th>
				</if>
			</tr>
			</thead>
			<tbody>
			<volist id="vo" name="list">
				<tr target="id" rel="{$vo.id}">
					<td>{$vo.postCode}</td>
					<td>{$vo.name}</td>
					<td>{$vo.typeID|get_magazine_type_name}</td>
					<td>{$vo.sort}</td>
					<td>{$vo.quantityPackage}</td>
					<td>{$vo.dbPersonID|get_employee_name}</td>
					<if condition="($roleEname eq 'admin') OR ($roleEname eq 'customCenterWorker')">
					<td><if condition="($vo.status neq '-1')">正常<else/><a callback="navTabAjaxMenu" target="ajaxTodo" href="__URL__/recycle/id/{$vo.id.}/navTabId/{$Think.const.MODULE_NAME}"><font color="red">还原</font></a></if></td>
					</if>
				</tr>
			</volist>
			</tbody>
		</table>

		<div class="panelBar">
			<div class="pages">
				<span>共{$totalCount}条</span>
			</div>
			<div class="pagination" targetType="navTab" totalCount="{$totalCount}" numPerPage="{$numPerPage}" pageNumShown="10" currentPage="{$currentPage}"></div>
		</div>

	</div>
	
</div>

